<template>
    <div class="active">
        <!-- 分类导航 -->
        <div class="nav">
            <ul>
                <li v-for="(item,index) in navList" :key="index" @click="clicknav(item.type)">{{item.type}}</li>
                
            </ul>
        </div>
        <!-- 活动内容 -->
        <div class="content">
            <active-list :cardList="cardList"></active-list>
            
            <!-- <div class="content_bottom">
                    <el-pagination
                        @size-change="handleSizeChange"
                        @current-change="handleCurrentChange"
                         v-model:currentPage="currentPage1"
                        :page-size="pagesize"
                        layout="total, prev, pager, next"
                        :total="80">
                    </el-pagination>
            </div> -->
        </div>
    </div>
    
</template>

<script>
import ActiveList from '@/components/ActiveList.vue'
import apiData from '../assets/apiData'
export default {
    name:"Active",
    data() {
        return {
            navList:[],
            cardList:[],
        // 每页5条
        pagesize:5,
        // 当前页
        currentPage1:1,
        // 总数
        total:80
       }
    },
    created() {
        apiData.ActiveMenu.getMenu().then(res=>{
            this.navList = res.data;
        });
        apiData.dateList.getList().then(res=>{
            this.cardList = res.data;
        });
    },
    methods: {
        clicknav(index){
            apiData.dateList.getList(index).then(res=>{
            this.cardList = res.data;
        });         
        },
    handleSizeChange(val) {
        console.log(`每页 ${val} 条`);
      },
      handleCurrentChange(val) {
        console.log(`当前页: ${val}`);
      }
    },
    components:{
        ActiveList
    }
}
</script>


<style  scoped>
.active{
     width: 1247px;
  /* height: 1500px; */
  margin: 0 auto;
  background-color: #eee;
}
.nav{

    margin-top: 20px;
    margin-left: 20px;
    width: 900px;
    /* height: 70px; */
    /* background-color: pink; */
}
.nav ul{
    display: flex;
    flex-wrap: wrap;
    /* justify-content: space-between; */
}
.nav ul li{
    margin-top: 5px;
    margin-left: 15px;
    text-align: center;
    line-height:30px;
    width: 10%;
    height: 30px;
    background-color: #ccc;
    cursor: pointer;
    font-size: 14px;
}
.nav ul li:hover{
    background-color:#FE8B02;
    color: #fff;
}
.content{
    position: relative;
    margin-top: 20px;
    width: 100%;
    /* height: 950px; */

    /* background-color: pink; */
}
.content_bottom{
    position:absolute;
    bottom: 20px;
    width: 100%;
    height: 40px;
    /* background-color: pink; */
    text-align: center;
    line-height: 40px
}
</style>